local planetC = require("planeta")

M = {}

local newLevel = function()
    local backgroundGroup = display.newGroup()
    local planetGroup = display.newGroup()
    
    local planet1 = planetC.newPlanet(120,120,40,100);
    planetGroup:insert(planet1)
    backgroundGroup:insert( planet1.atmosferaCircle )
    
    local planet2 = planetC.newPlanet(320,420,50,100);
    planetGroup:insert(planet2)
    backgroundGroup:insert( planet2.atmosferaCircle )
    
    local planet3 = planetC.newPlanet(510,-120,50,100);
    planetGroup:insert(planet3)
    backgroundGroup:insert( planet3.atmosferaCircle )
    
    local planet4 = planetC.newPlanet(820,20,40,100);
    planetGroup:insert(planet4)
    backgroundGroup:insert( planet4.atmosferaCircle )
  
    local planet5 = planetC.newPlanet(1120,620,40,100);
    planetGroup:insert(planet5)
    backgroundGroup:insert( planet5.atmosferaCircle )
    
    local planet6 = planetC.newPlanet(1320,320,50,100);
    planetGroup:insert(planet6)
    backgroundGroup:insert( planet6.atmosferaCircle )
    
    local planet7 = planetC.newPlanet(1410,-520,50,100);
    planetGroup:insert(planet7)
    backgroundGroup:insert( planet7.atmosferaCircle )
    
    local planet8 = planetC.newPlanet(1020,220,30,100);
    planetGroup:insert(planet8)
    backgroundGroup:insert( planet8.atmosferaCircle )
    
     
    local planet9 = planetC.newPlanet(920,-320,40,100);
    planetGroup:insert(planet9)
    backgroundGroup:insert( planet9.atmosferaCircle )
    
    local planet10 = planetC.newPlanet(1520,-320,70,100);
    planetGroup:insert(planet10)
    backgroundGroup:insert( planet10.atmosferaCircle )
    
    local planet11 = planetC.newPlanet(1710,-420,50,100);
    planetGroup:insert(planet11)
    backgroundGroup:insert( planet11.atmosferaCircle )
    
    local planet12 = planetC.newPlanet(1920,-220,30,100);
    planetGroup:insert(planet12)
    backgroundGroup:insert( planet12.atmosferaCircle )
    
    --    for i = 1, 3 do
    --        for j = -1, 1 do
    --            local pran= math.random (1, 5)
    --            local sizeran = math.random (3, 6)    
    --            local xran = math.random (50, 500)
    --            local yran = math.random (50, 500)
    --            local planet =  display.newImage("planet"..tostring(pran)..".png", 10* sizeran,10* sizeran)
    --            planet.x= i* 1000 + xran 
    --            planet.y=j* 1000 +yran
    --            physics.addBody(planet, "static", { density = 0.1, friction = 0.1, bounce = 0.0, radius = planet.width / 2 })
    --            planetGroup:insert(planet)
    --        end
    --        
    --    end
    
    return planetGroup,backgroundGroup
end

M.newLevel = newLevel

return M